using UnityEngine;

public class CellChooseTransport : SelectableButton
{
	[HideInInspector]
	public Product carProduct;

	[HideInInspector]
	public GameTypeSelector gameTypeSelector;

	public UITexture icon;

	public UILabel lbName;

	public TypeMatchForButton typeMatch;

	public GameObject _widget;

	public override void Select(bool select)
	{
		if ((bool)gameTypeSelector)
		{
			gameTypeSelector.carInfo.ShowMiniInfoPanel(carProduct);
		}
		switch (typeMatch)
		{
		case TypeMatchForButton.Car:
			settings.RaceCarName = carProduct.id;
			PreviewTransportController.instance.ShowTransport(carProduct.id);
			break;
		case TypeMatchForButton.Tank:
			settings.SelectedTankName = carProduct.id;
			PreviewTransportController.instance.ShowTransport(carProduct.id);
			break;
		}
		base.Select(select);
	}

	private void Update()
	{
		float value = ((TransportButtonController)selectableButtonController).maxScale * (1f - Mathf.Abs(base.transform.position.x) / ((TransportButtonController)selectableButtonController).maxDistance);
		value = Mathf.Clamp(value, ((TransportButtonController)selectableButtonController).minScale, ((TransportButtonController)selectableButtonController).maxScale);
		base.transform.localScale = Vector3.Lerp(base.transform.localScale, Vector3.one * value, Time.deltaTime * 30f);
	}
}
